package com.chenkun.common.define;

import java.io.Serializable;

/**
 * Created by chenkun on 2017/5/8.
 */
public class CommRes<T> implements Serializable {

    private static final long serialVersionUID = 8090162147360127302L;

    private String res;
    private String message;
    private T data;

    public String getRes() {
        return res;
    }

    public void setRes(String res) {
        this.res = res;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static CommRes error(String res, String message){
        CommRes commRes = new CommRes();
        commRes.setRes(res);
        commRes.setMessage(message);
        return commRes;
    }

    public static CommRes success(Object data){
        CommRes commRes = new CommRes();
        commRes.setRes("200");
        commRes.setMessage("SUCCESS");
        commRes.setData(data);
        return commRes;
    }

    public static CommRes success(){
        CommRes commRes = new CommRes();
        commRes.setRes("200");
        commRes.setMessage("SUCCESS");
        return commRes;
    }
}